<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="demo">
			<button-counter title="aa"></button-counter>
			<button-counter title="bb"></button-counter>
			<button-counter title="cc"></button-counter>
		</div>
		<script type="text/javascript">
			//全局注册组件	
			Vue.component('button-counter', {
				props:['title'],
				//组件的data，必须是function函数
				data: function() {
					return {
						count: 0
					}
				},
				template: '<button v-on:click="count++">点击{{title}}次数{{count}}</button>'
			});
			new Vue({
				el: "#demo"
			});
		</script>

	</body>
</html>
